function getAllCookie() {
  var cookie = document.cookie;
  var list = cookie.split('; ');
  return list.reduce(function (total, value) {
    total[value.split('=')[0]] = value.split('=')[1]
    return total;
  }, {});
}
// 获取特定的cookie
function getCookie(name) {
  return getAllCookie()[encodeURIComponent(name)] ? decodeURIComponent(getAllCookie()[encodeURIComponent(name)]) : '';
}


var username = getCookie('login_user');
if (username) {
  $('.logined').css('display', 'block');
  $('.username').text(username);
} else {
  $('.nologin').css('display', 'block');
}